package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.util.*;
import java.io.*;
import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.sql.Connection;
import java.sql.Types;
import java.sql.PreparedStatement;
import com.asiainfo.ysrman.util.DBmanage;
import javax.servlet.http.HttpSession;
import javax.servlet.http.*;
import javax.servlet.http.Cookie;

public final class AwardList_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static java.util.Vector _jspx_dependants;

  static {
    _jspx_dependants = new java.util.Vector(1);
    _jspx_dependants.add("/uservalidate.jsp");
  }

  public java.util.List getDependants() {
    return _jspx_dependants;
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html; charset=GB18030");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write('\r');
      out.write('\n');
	
	//??????
	if (session.getAttribute("userid") == null||session.getAttribute("userid").equals(""))
	{	
		//response.sendRedirect("index.jsp");
		out.println("<script language=\"javaScript\">parent.document.frames.top.window.location.href='index.jsp';</script>");
		return;
	}

      out.write("\r\n");
      out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\r\n");
      out.write("<html>\r\n");
      out.write("    <head>\r\n");
      out.write("        <meta http-equiv=\"Content-Type\" content=\"text/html; charset=GB18030\">\r\n");
      out.write("        <link href=\"styles/styles.css\" rel=\"stylesheet\" type=\"text/css\">\r\n");
      out.write("        <META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\"> \r\n");
      out.write("        <META HTTP-EQUIV=\"Cache-Control\" CONTENT=\"no-cache\"> \r\n");
      out.write("        <META HTTP-EQUIV=\"Expires\" CONTENT=\"0\">\r\n");
      out.write("        <script src=\"script/calendar.js\"></script>\r\n");
      out.write("        <style type=\"text/css\">\r\n");
      out.write("            <!--\r\n");
      out.write("            body {\r\n");
      out.write("            background-color:#ffffff;\r\n");
      out.write("            }\r\n");
      out.write("            -->\r\n");
      out.write("        </style>\r\n");
      out.write("        <title>导入数据</title>\r\n");
      out.write("    </head>\r\n");
      out.write("    <body>\r\n");
      out.write("        <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n");
      out.write("            <tr>\r\n");
      out.write("                <td width=\"60\" height=\"50\" align=\"right\" valign=\"middle\"><img src=\"images/menu_01.jpg\" width=\"60\" height=\"50\"></td>\r\n");
      out.write("                <td height=\"50\" align=\"left\" valign=\"middle\" background=\"images/menu_04.jpg\" class=\"huanying\">抽奖中奖记录</td>\r\n");
      out.write("                <td width=\"74\" height=\"50\" align=\"left\" valign=\"top\"><img src=\"images/menu_02.jpg\" width=\"74\" height=\"50\"></td>\r\n");
      out.write("            </tr>\r\n");
      out.write("        </table>\r\n");
      out.write("        <form method=\"post\" action=\"\" >\r\n");
      out.write("            <table width=\"100%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n");
      out.write("                <tr>\r\n");
      out.write("                    <td background=\"images/choujiangbg.jpg\">&nbsp;&nbsp;&nbsp;&nbsp;</td>\r\n");
      out.write("                    <td background=\"images/choujiangbg.jpg\"><input name=\"vType\" type=\"radio\" value=\"1\" checked>\r\n");
      out.write("                    9.16济南门票\r\n");
      out.write("                    <input type=\"radio\" name=\"vType\" value=\"2\">\r\n");
      out.write("                    9.22广州门票\r\n");
      out.write("                    <input type=\"radio\" name=\"vType\" value=\"3\">\r\n");
      out.write("                    9.29北京门票\r\n");
      out.write("                    <input type=\"radio\" name=\"vType\" value=\"4\">\r\n");
      out.write("                    10.13杭州门票\r\n");
      out.write("                    <input type=\"radio\" name=\"vType\" value=\"5\">\r\n");
      out.write("                    10.20颁奖门票 </td>\r\n");
      out.write("                    <td valign=\"middle\" background=\"images/choujiangbg.jpg\"><input name=\"imageField\" type=\"image\" src=\"images/zhucetijiao.jpg\" width=\"67\" height=\"24\" border=\"0\"></td>\r\n");
      out.write("                    <td width=\"22\"><img src=\"images/choujiangright.jpg\" width=\"22\" height=\"34\"></td>\r\n");
      out.write("                </tr>\r\n");
      out.write("            </table>\r\n");
      out.write("        </form>\r\n");
      out.write("        ");

            Connection conn = null;
            conn = DBmanage.getInstance().getConnection();
            PreparedStatement ps4 = null;
            ResultSet rs4 = null;

            int vType=0;
            try{
                vType=Integer.parseInt(request.getParameter("vType"));
            }catch(Exception e){}

            int nPage=20;//每页显示数量
            int p=0;//当前页数
            try{
                p=Integer.parseInt(request.getParameter("p"));
            }catch(Exception e){
                p=0;
            }
            ps4 = conn.prepareStatement("select * from yl_awardrec where TICKETNAME='"+vType+"'");
            rs4 = ps4.executeQuery();
        
      out.write("\r\n");
      out.write("        <form name=\"frm1\" method=\"post\">\r\n");
      out.write("            <table width=\"100%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n");
      out.write("                <tr>\r\n");
      out.write("                    <td height=\"35\" colspan=\"5\" class=\"suoyin\">&nbsp;&nbsp;<span class=\"huanying\"><font color=\"#FF0000\">");

                        switch(vType){
                            case 1:
                                out.print("9.16济南门票");
                                break;
                            case 2:
                                out.print("9.22广州门票");
                                break;
                            case 3:
                                out.print("9.29北京门票");
                                break;
                            case 4:
                                out.print("10.13杭州门票");
                                break;
                            case 5:
                                out.print("10.20颁奖门票");
                                break;
                        }
                    
      out.write("</font>&nbsp;中奖名单</span></td>\r\n");
      out.write("                </tr>\r\n");
      out.write("                <tr class=\"shujutittle\">\r\n");
      out.write("                    <td>序号</td>\r\n");
      out.write("                    <td>手机号</td>\r\n");
      out.write("                    <td>所属地区</td>\r\n");
      out.write("                    <td>所中奖项</td>\r\n");
      out.write("                    <td>产品类型</td>\r\n");
      out.write("                </tr>\r\n");
      out.write("                ");

                    int iCount=0;
                    for(int jj=0;jj<p*nPage;jj++){
                        if(rs4.next()){
                            iCount++;
                        }
                    }
                    for(int jj=0;jj<nPage;jj++){
                        if(rs4.next()){
                            iCount++;
                
      out.write("\r\n");
      out.write("                <tr ");
if(iCount%2==1){out.print("class=\"erjitable\"");}
      out.write(">\r\n");
      out.write("                    <td align=\"right\">");
      out.print((p*nPage+jj+1));
      out.write("</td>\r\n");
      out.write("                    <td align=\"center\">");
      out.print(rs4.getString("mobile"));
      out.write("</td>\r\n");
      out.write("                    <td align=\"center\">");
      out.print(rs4.getString("areaname"));
      out.write("</td>\r\n");
      out.write("                    <td align=\"center\">\r\n");
      out.write("                        ");

                            switch(rs4.getInt("awardtype")){
                                case 1:
                                    out.print("一等奖(至尊奖)");
                                    break;
                                case 2:
                                    out.print("二等奖(叱诧奖)");
                                    break;
                                case 3:
                                    out.print("三等奖(人气奖)");
                                    break;
                                case 4:
                                    out.print("四等奖(炫彩奖)");
                                    break;
                            }
                        
      out.write("\r\n");
      out.write("                    </td>\r\n");
      out.write("                    <td align=\"center\">\r\n");
      out.write("                        ");

                            switch(rs4.getInt("pro_type")){
                                case 1:
                                    out.print("瓶");
                                    break;
                                case 2:
                                    out.print("砖");
                                    break;
                                case 3:
                                    out.print("六连包");
                                    break;
                            }
                        
      out.write("\r\n");
      out.write("                    </td>\r\n");
      out.write("                </tr>\r\n");
      out.write("                ");

                    }
                    }
                    while(rs4.next()){
                        iCount++;
                    }
                
      out.write("\r\n");
      out.write("                <tr>\r\n");
      out.write("                    <td colspan=\"5\" class=\"shujutittle\">共");
      out.print(iCount);
      out.write("条记录&nbsp;&nbsp;每页显示");
      out.print(nPage);
      out.write("条&nbsp;&nbsp;\r\n");
      out.write("                    ");

                        int pageNum;
                        if(iCount%nPage==0){
                            pageNum=iCount/nPage;
                        }else{
                            pageNum=iCount/nPage+1;
                        }
                        out.print("分"+pageNum+"页显示");
                    
      out.write("&nbsp;&nbsp;第&nbsp;\r\n");
      out.write("                    ");

                        for(int n=0;n<pageNum;n++){
                                out.print("<a href=\"AwardList.jsp?state=1&restart=0&p="+n+"\">");
                                if(n==p){
                                    out.print("<font color=\"#ff0000\">");
                                }else{
                                    out.print("<font color=\"#999999\">");
                                }
                                out.print(n+1);
                                out.print("</font></a>");
                                out.print("&nbsp;");
                        }
                    
      out.write("&nbsp;页</td>\r\n");
      out.write("                </tr>\r\n");
      out.write("                <tr align=\"center\" bgcolor=\"#CCCCCC\">\r\n");
      out.write("                    <td height=\"20\" colspan=\"5\">&nbsp;</td>\r\n");
      out.write("                </tr>\r\n");
      out.write("            </table>\r\n");
      out.write("        </form>\r\n");
      out.write("\r\n");
      out.write("    </body>\r\n");
      out.write("</html>\r\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}
